﻿#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>

typedef double Real;

typedef struct {
	int m;
	int n;
	int data[20][20];
}Matrix;
 
typedef struct 
{
	Matrix m;
}Context;

Context context;
 
Matrix* read_mat(Matrix* A)
{
	scanf("%d %d", &A->m, &A->n);
	for (int i = 0; i < A->m; ++i)
		for (int j = 0; j < A->n; ++j)
			scanf("%d", &A->data[i][j]);
	return A;
}

void read_data(Context* ctx)
{
	read_mat(&ctx->m);
}

void do_task(Matrix* mat)
{
	int k = 0;
	for (int i = 1; i < mat->m - 1; ++i)
		for (int j = 1; j < mat->n - 1; ++j)
			if (mat->data[i][j] > mat->data[i - 1][j] && mat->data[i][j] > mat->data[1 + i][j] && mat->data[i][j] > mat->data[i][j - 1] && mat->data[i][j] > mat->data[i][1 + j]) {
				printf("%d %d %d\n", mat->data[i][j], i + 1, j + 1);
				++k;
			}
	if (k == 0)
		printf("None %d %d\n", mat->m, mat->n);
}

void solve(Context* ctx)
{
	read_data(ctx);
	do_task(&ctx->m);
}

int main()
{
	freopen("D:/Develop/GitRepos/MOOC/浙江大学/数据结构/201906/DataStructure/M2019秋C入门和进阶练习集/7-153.txt", "r", stdin);
	solve(&context);
	return 0;
}
